/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package imageloading;

import plash.display.Loader;
import plash.display.Stage;
import plash.events.Event;
import plash.events.IEventListener;
import plash.events.LoadEvent;
import processing.core.PApplet;

/**
 *
 * @author #0K Srinivasan <hashok.com>
 */
public class ImageLoading extends Stage implements IEventListener
{
    private Loader _imageBox = new Loader();

    public ImageLoading()
    {
        super();
        _initialize();
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args)
    {
        // TODO code application logic here
        PApplet.main(new String[]{"imageloading.ImageLoading"});
    }

    private void _initialize()
    {
        _imageBox.setImageURL("media/Koala.jpg");
//        _imageBox.setX(100);
//        _imageBox.setY(100);
        _imageBox.setScaleX(0.2f);
        _imageBox.setScaleY(0.2f);
        this.addChild(_imageBox);
        _imageBox.addEventListener(LoadEvent.COMPLETE, this);
        _imageBox.addEventListener(Event.ENTER_FRAME, this);
    }

    @Override
    public void event(Event e)
    {
        _imageBox.setRotation(_imageBox.getRotation() + 1);
    }
}
